<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="" method="GET">
        <p><label for="">用户名：</label><input type="text" name="ues" id=""></p>
        <p><label for="">密&emsp;码：</label><input type="password" name="pwd" id=""></p>
        <p>
            <label for="">兴&emsp;趣：</label>
            <label for="">篮球</label><input type="checkbox" name="hobby" id="">
            <label for="">游泳</label><input type="checkbox" name="hobby" id="">
            <label for="">骑车</label><input type="checkbox" name="hobby" id="">
        </p>
        <p><input type="submit" name="" id="" value="上传"></p>
    </form>
    <button id="get">获取</button>
    <button id="set">设置</button>
</body>
<script>
    var get = document.getElementById("get");
    var set = document.getElementById("set");
    console.log(location);
    get.onclick = function() {
        console.log(location.href);
        console.log(location.origin);
        console.log(location.port);
    }
    set.onclick = function() {
        location.href = "https://www.baidu.com";
    }
</script>
</html>